<template>
  <div id="app">
    <div id="app">
      <!-- v-for 把一组数据, 渲染成一组DOM -->
      <!-- 口诀: 让谁循环生成, v-for就写谁身上 -->
      <p>学生姓名</p>
      <ul>
          <li v-for="obj in stuArr">
              <span>{{obj.id}}</span>
              <span>{{obj.name}}</span>
              <span>{{obj.sex}}</span>
              <span>{{obj.hobby}}</span>
          </li>
      </ul>
      <!-- v-for遍历对象(了解) -->
      <p>老师信息</p>
      <div v-for="(item,index) in tObj">
          <span>{{item}}---{{index}}</span>
      </div>

      <!-- v-for遍历整数(了解) - 从1开始 -->
      <p>序号</p>
      <div v-for="n in count">{{n}}</div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["小明", "小欢欢", "大黄"],
      stuArr: [
        {
          id: 1001,
          name: "孙悟空",
          sex: "男",
          hobby: "吃桃子",
        },
        {
          id: 1002,
          name: "猪八戒",
          sex: "男",
          hobby: "背媳妇",
        },
      ],
      tObj: {
        name: "小黑",
        age: 18,
        class: "1期",
      },
      count: 10,
    };
  },
};
</script>